package org.aptech.hdax.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.aptech.hdax.dao.SysPerMissionDao;
import org.aptech.hdax.pojo.SysPermission;
import org.aptech.hdax.pojo.SysRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/sysPermission")
public class SysPermissionController {
    @Autowired
    private SysPerMissionDao sysPerMissionDao;

    @RequestMapping("/index")
    public String index() throws Exception {
        return  "system/permission/index";
    }

    @RequestMapping("/parentPers")
    @ResponseBody
    public List<SysPermission> parentPers() throws Exception{
        return sysPerMissionDao.getParentPers();
    }

    @RequestMapping("/list")
    @ResponseBody
    public Map<String,Object> list() throws Exception{
        Map<String,Object> map = new HashMap<>();

        map.put("code",0);
        map.put("msg",null);
        map.put("data",sysPerMissionDao.getAll());

        return map;
    }
}
